home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 May: Tool Chest / Developer CD Series Tool Chest (Apple Computer)(May 1999).iso / Tool Chest / Development Kits / MPW etc / MPW-GM / MPW / Examples / CFMExamples / CSharedLibrarySample / SharedLib.c < prev    next >
Encoding:
Text File  |  1998-12-03  |  975 b   |  46 lines  |  [TEXT/MPS ]

  1. //
  2. //    SharedLib.c - Source file for simple shared library
  3. //
  4. //
  5. //    Copyright © 1993, Apple Computer, Inc.  All rights reserved.
  6. //
  7.  
  8. #include "SharedLib.h"
  9. #include <Menus.h>
  10. #include <Devices.h>
  11. #include <Events.h> 
  12.  
  13. char theMessage[80];
  14.  
  15.  
  16. static void showMessage (WindowPtr theWindow);
  17. static void myPause (void);
  18.  
  19. #pragma export list DoMessage
  20.  
  21. void DoMessage (WindowPtr aWindow)
  22. {
  23.     strcpy (theMessage, (const char *) "\pIn Shared Library");
  24.     showMessage (aWindow);
  25.     myPause ();
  26. }
  27.  
  28.  
  29. static void showMessage (WindowPtr theWindow)
  30. {    
  31.     SetPort (theWindow);
  32.     MoveTo (((theWindow->portRect.right-theWindow->portRect.left) / 2) - 
  33.              (StringWidth ((ConstStr255Param)theMessage) / 2), 
  34.              (theWindow->portRect.bottom-theWindow->portRect.top) / 2);
  35.     TextFont (systemFont);
  36.     DrawString ((ConstStr255Param)theMessage);
  37. }
  38.  
  39.  
  40. static void myPause (void)
  41. {
  42.     while (!Button ())   /* wait for user to click */
  43.       SystemTask ();  /* Give some cpu time to other things running. */
  44. }
  45.  
  46.